package com.memory.licenseclient.config;

import com.memory.licenseclient.interceptor.LicenseCheckInterceptor;
import jakarta.annotation.Resource;
import org.springframework.stereotype.Component;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;



/**
 * @author zuiyu
 * @date 2022/8/15
 * @description
 * @link https://github.com/zuiyu-main
 */
@Component
public class InterceptorConfig implements WebMvcConfigurer {
    @Resource
    private LicenseCheckInterceptor licenseCheckInterceptor;

    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        registry.addInterceptor(licenseCheckInterceptor)
                // 拦截路径
                .addPathPatterns("/**")
                // 放行路径
                .excludePathPatterns("/login");
    }
}
